package com.onec.service.jvm;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import java.lang.reflect.Field;

public class MethodHandle {


  public void main(String[] args) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException {
    MethodType mt = MethodType.methodType(void.class);
    Field lookupImpl = MethodHandles.Lookup.class.getDeclaredField("IMPL_LOOKUP");
    lookupImpl.setAccessible(true);
    java.lang.invoke.MethodHandle mh = ((Lookup) lookupImpl.get(null))
        .findSpecial(MethodHandle.class, "thinking", mt, MethodHandle.class);
    try {
      mh.invoke(this);
    } catch (Throwable throwable) {
      throwable.printStackTrace();
    }


  }
}
